package main;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import presentation.WsepGUI;
import interfaces.UI;
import java.util.Date;

/**
 * here we have the main method (which only invokes the UI).
 * @author awarmanX
 *
 */
public class ClientMainGUI {

	/**
	 * this main methods activates the UI program and also connects to the server.
	 */
	public static void main(String[] args) {
		System.out.println("starting client");
		Date date = new Date();
		System.out.println(date);

		UI ui = new WsepGUI(); //the textual UI we currently have
		ui.connect("localhost", getPort());

		try {
			ui.showWelcomePage(); // from here all the action is in the UI class
		} catch (IOException e) {
			System.out.println(e.getMessage());
		}
	}

	private static int getPort() {
		String str="0";
		try {
	        BufferedReader in = new BufferedReader(new FileReader("port.txt"));
	        str = in.readLine();
	        in.close();
	    } catch (IOException e) {
	    }
		return Integer.parseInt(str);
	}

}